#import "RiddleMotionController.h"
        
#import "RiddleMotionModel.h"
#import "RiddleMotionCell.h"
#import "Masonry.h"

@interface RiddleMotionController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *oasisIdealTableView;
@property (nonatomic, strong) NSMutableArray *reverieLuminaryBinaryDataSource;

@end

@implementation RiddleMotionController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self flourishTransformInitview];
	[self essenceQuivergetData];
}


- (void)flourishTransformInitview {
    self.oasisIdealTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.oasisIdealTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    self.oasisIdealTableView.estimatedRowHeight = 0;
    self.oasisIdealTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.oasisIdealTableView.contentInset = UIEdgeInsetsMake(16, 0, 16, 0);
    self.oasisIdealTableView.delegate = self;
    self.oasisIdealTableView.dataSource = self;
    self.oasisIdealTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    self.oasisIdealTableView.showsVerticalScrollIndicator = NO;
    self.oasisIdealTableView.showsHorizontalScrollIndicator = NO;
    self.oasisIdealTableView.backgroundColor = UIColor.clearColor;
    [self.oasisIdealTableView registerClass:[RiddleMotionCell class] forCellReuseIdentifier:NSStringFromClass([RiddleMotionCell class])];
    [self.view addSubview:self.oasisIdealTableView];
    [self.oasisIdealTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(self.view);
        make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
    }];
}

//: 懒加载数据模型数组
- (NSMutableArray *)reverieLuminaryBinaryDataSource {
	if (!_reverieLuminaryBinaryDataSource) {
		_reverieLuminaryBinaryDataSource = [NSMutableArray array];
	}
	return _reverieLuminaryBinaryDataSource;
}

//: 获取数据模型
- (void)essenceQuivergetData {
	
}

#pragma mark - UITableView DataSource 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.reverieLuminaryBinaryDataSource.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    RiddleMotionCell *peacefulApple = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([RiddleMotionCell class])];
    if (peacefulApple == nil) {
        peacefulApple = [[RiddleMotionCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([RiddleMotionCell class])];
    }
    peacefulApple.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return peacefulApple;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	RiddleMotionModel *nostalgia = self.reverieLuminaryBinaryDataSource[indexPath.row];
	return nostalgia.zealCellHeight;
}


#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // cell tap action
}


@end
